Reporter Control Version 1.03 By Robert Wittig (76135,2105) Table of Contents ----------------- I. Introduction II. Pricing/Ordering III. Included Files IV. Documentation V. Concerning placement of text output VI. What's new in this version VII. Final Message I. Introduction --------------- This is the beta release of the Reporter component. This component assists the programmer in creating reports through the use of the following: 1) Measurements specified in Dots, Inches or Millimeters. The Reporter allows you to set the report's default unit to either printer dots (default), inches or millimeters. This allows you to (in most cases) completely ignore the printer's dots/inch. For direct output through the Reporter's canvas, you need to specify positioning in dots. ConvertWidth and ConvertHeight functions are included to aid you in converting between inches/millimeters and dots in these cases. 2) Bands - Full Page, Header, Group, Detail, and Footer. The Reporter provides support for "bands". A band is a portion of the page set aside for a specific function. Each band has a printing event associated with it. The Reporter is responsible for calling the print events in the proper order, freeing the programmer from coordinating the output of headers, footers and details and from deciding when a new page is required. Using the Reporter, a simple multi-page report could be printed out with only one output call! (in the detail band) 3) Support for memo output. You may output a memo from tMemo, tDBMemo, tMemoField or pChar. You can constrain the width and height of the memo, or you can constrain only the width and let the Reporter determine the height. The Reporter also allows you to "stretch" a band's height to accomodate oversized memos. 4) Native support for tGraphic, tChartFX, tImage and tGraphicField. The Reporter handles the details of positioning these graphic objects on the page, as well as scaling them to the dimensions you specify. 5) Named font styles. The Reporter allows you to assign names to a font (color,size, style,typeface) style. Then, later in the report, you can change the font to one of your pre-defined styles by referring to its name. 6) Reporter Canvas The Reporter provides access to the printed page through its Canvas property. Through this property, you may use any output call that applies to a tCanvas object. 7) Miscellaneous features. The Reporter has several other features that assist the programmer in creating a report, including the ability to change page orientation between pages, changing the report's header and footer "on the fly" and alignment of output (text or graphic) anywhere within a band through the use of positioning constants. I will continue adding features to the Reporter as the need develops. Also, I will be adding a wrapper component that will allow you to set up a report and preview the output while in Delphi design mode. II. Pricing/Ordering --------------------- The Reporter is being released as shareware. It will only run while Delphi is running. If you attempt to use it without Delphi, you will be informed that you can only use it while Delphi is running. If you continue to try to use it, you will get a GPF (because the Reporter is not created if Delphi is not running). With that out of the way, on to pricing. If you wish to distribute reports using the Reporter, you may register the Reporter for $30 + $5 shipping/ handling ($15 outside North America-sorry for the extra charge, but shipping prices are fairly high outside North America). You may also choose to register and receive the documentation/source code only through email, for a flat $30 charge. With your registration, you will receive: 1) A E-Mailed copy of the current Reporter along with full source code, 2) Any updates made to the Reporter (including any tools developed to facilitate the use of the Reporter) for a period of one year dating from the time of your registration. 3) Printed documentation and Reporter/source code on disk when the Reporter is released in a non-beta format (if you chose that payment option). As a registered user, you can: 1) Distribute programs that use the Reporter without paying any royalties. 2) Modify the source code for your own use (though this tends to negate support for the Reporter, the more you modify). As a registered user, you cannot: 1) Distribute the source code, either in its original state, or in modified form. (Although you are free to borrow the concepts it embodies) 2) Resell the Reporter to a third party. The registration fee is (as stated above) $30 with an optional $5 shipping/ handling ($15 outside North America). You may either mail this to me at the following address or register on CompuServe through one of the following SWREG IDs. To register on CompuServe, GO SWREG and choose Register Shareware from the list of options. If you register through the mail, please include your name, company name (optional), street address, city, state and zip. If you do not include these, you will not receive the Reporter. If you send a check, please make it payable to Robert Wittig. Robert Wittig PO BOX 8052 Fort Smith, AR 72902-8052 SWREG ID#5830 Reporter with hard-copy documentation/source code on disk. SWREG ID#5832 Reporter without hard-copy documentation/source code on disk. III. Included Files -------------------- PSTATUS.DFM A simple print status dialog form that informs the user of the PSTATUS.PAS current status of the report and allows the report to be aborted. REPORTS.INT The interface and compiled unit form of the Reporter. REPORTS.DCU README.TXT This file. The sample reports assume that you have a database alias DBDEMOS defined, and that it points to the sample database files installed with Delphi. If, for some reason, you don't have this alias you will need to change the DatabaseName property of each table and query used in the sample reports. ------------------------------------------------------------ MASTRPT.DPR These files compose the sample M.A.S.T. report. This report MASTRPT.RES mimics the report included in the MASTAPP demo that ships MASTRPT1.PAS with Delphi. Text output is highlighted in this example. MASTRPT1.DFM SUMMRPT.DPR These files compose the Summary report. This report demon- SUMMRPT.RES strates how to use groups along with detail bands, as well SUMMRPT1.PAS as giving an example of the use of a report variable. SUMMRPT1.DFM CHRTRPT.DPR These files compose the ChartFX report. This report demon- CHRTRPT.RES strates how to output a ChartFX on the page. CHRTRPT1.PAS CHRTRPT1.DFM BOXRPT.DPR These files compose the Header/Orientation report. This report BOXRPT.RES demonstrates using the canvas for graphic output, changing the BOXRPT1.PAS page orientation between pages of a report, as well as changing BOXRPT1.DFM the report's header across pages. FISHRPT.DPR These files compose the FishFacts report. This report high- FISHRPT.RES lights the use of the Reporter to output graphics stored in FISHRPT1.PAS a database. It also demonstrates how to let a band's height FISHRPT1.DFM stretch to accomodate a large memo, while still preventing the band from being split across pages. To run any of these demos, just open the appropriate project file and run it (Run/Run from the main menu or F9). IV. Documentation ------------------ Since the Reporter is still in the beta stage, the documentation is limited to this file, comments in Reports.Int (which are fairly extensive) and comments in the sample reports. More formal documentation will be forth- coming as the Reporter nears completion and the chance of major changes to the code/operation is removed. If you need help deciphering a Reporter function or figuring out how to do something, check the sample reports or send me a message/email on CompuServe (76135,2105). V. Concerning placement of text output --------------------------------------- Currently, the Reporter outputs text so that the upper left corner of the text is aligned with the current print head position. Under most circum- stances, this does not matter. However, if you wish to mix font sizes on the same line, you will need to do some extra maneuvering to ensure that the bottom of the text lines up rather that the top. The MastApp demo contains a sample of this type of positioning. A future enhancement already being planned is to allow you to specify whether text aligns upper left or bottom left to the print head. VI. What's new in this version ------------------------------- This version adds the following: 1) Reporter.PreferredUnit By setting PreferredUnit, the user can specify print output positioning without needing to convert to printer dots. Reporter.PreferredUnit := puInches; Reporter.TabTo ( 2.0 ); For example, the above statements cause the Reporter to position the print head 2 inches from the left margin. 2) Memo output. The Reporter now has procedures (DirectMemoOut, MemoOut, and DBMemoOut) that allow you to print memos. DirectMemoOut takes a null-terminated string as an argument. MemoOut takes either a tMemo or tDBMemo component as an argument. DBMemoOut takes a tMemoField as an argument. You can specify a box to print the memo in and the Reporter will clip output beyond the bounds of the box. Alternatively, you can set the width of the box only, and the Reporter will determine the height of the box. See FishRpt for an example of memo output. 3) Reporter.StretchBand By setting StretchBand true or false (default), you can tell the Reporter whether or not to allow a band's height to be dynamic. This property was added mostly in support of memos. Quite often, you'll have memos that aren't the same size. You usually want memos to print with the rest of the detail, as opposed to printing across pages. However, you don't want to set the band height to accomodate the height of the largest memo, because you'll have a lot of wasted space. So, I added the StretchBand property. If you set this to true, the Reporter will call the InitBand procedure (if you've defined it) each time the band prints. This way, the Reporter will know how tall the band is and can use only as much space as is needed, while also preventing the band from breaking across pages. The FishRpt demo provides an example of the use of StretchBand. The following bugs have been fixed: 1) A bug in the way TabTo and MoveY has been fixed. They had been moving the print head relative to the non-printable area, rather than the margins. That has now been fixed. VII. Final Message ------------------- I would very much appreciate any comments/gripes/suggestions you have regarding the Reporter. If you detect a bug, or something doesn't work the way you think it should, just let me know. I hope you enjoy using the Reporter and it helps take a load off your shoulders. - Robert Wittig 76135,2105